﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Theme="SkinFile"
    CodeFile="docs.aspx.cs" Inherits="DirFilesPage" Title="文档管理" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
<script type="text/javascript">
function InvokePopUploadDocs(dirid,dirname)
{      
     //父窗体的客户端控件ID，会回调此客户端ID的事件
     var pccid='<%=this.btnHiddenAddFile.ClientID%>';
     window.open('uploadfile2.aspx?docs&pccid='+pccid+'&m=1&dirid='+dirid+'&dirname='+encodeURI(dirname)  ,'上传文件','dialogHeight:400px;dialogWidth:600px;resizable:no;center:yes'); 
}

function InvokePopRename(fileid,filename)
{      
     //父窗体的客户端控件ID，会回调此客户端ID的事件
     var pccid='<%=this.btnHiddenAddFile.ClientID%>';
     window.open('rename.aspx?pccid='+pccid+'&fileid='+fileid+'&filename='+encodeURI(filename)  ,'文件重命名','dialogHeight:400px;dialogWidth:400;resizable:no;center:yes'); 
}


</script>


<h1 id="pagetitle" class="pagetitle">
        文档管理
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
            <ProgressTemplate>
                <div class="anistyle" id="ani">
                    正在加载数据，请耐心等待...
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </h1>
<div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="20%" valign="top">
                        <asp:TreeView ID="dirTreeView" runat="server" Height="100%" ImageSet="WindowsHelp"
                            Width="100%" OnSelectedNodeChanged="dirTreeView_SelectedNodeChanged" >
                            <ParentNodeStyle Font-Bold="False" />
                            <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
                            <SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px"
                                VerticalPadding="0px" />
                            <NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="5px"
                                NodeSpacing="0px" VerticalPadding="1px" />
                        </asp:TreeView>
                        <br />
                    </td>
                    <td width="80%" valign="top">
                        <asp:Panel ID="panelDgvFileList" runat="server">
                            <asp:GridView ID="GridView1" runat="server" Width="100%" AutoGenerateColumns="False"
                                DataKeyNames="File_Id" OnRowDataBound="GridView1_RowDataBound" SkinID="gridviewSkin">
                                <%--<RowStyle Height="20px" />
                                <HeaderStyle BackColor="#E0E0E0" ForeColor="Black" Height="24px" />
                                <AlternatingRowStyle BackColor="#F7F7F7" />--%>
                                <Columns>
                                    <asp:BoundField DataField="File_ID" HeaderText="编号" />
                                    <asp:BoundField DataField="File_Name" HeaderText="文件名称" />
                                    <asp:BoundField DataField="File_Create_Time" DataFormatString="{0:d}" HeaderText="创建时间" />
                                    <asp:HyperLinkField DataNavigateUrlFields="File_ID" DataNavigateUrlFormatString="getfile.aspx?fileid={0}"
                                        HeaderText="下载" Target="_blank" Text="下载" />
                                    <asp:TemplateField HeaderText="操作">
                                        <ItemTemplate>
                                            &nbsp;<asp:LinkButton ID="GvDelete" runat="server" OnClick="GvDelete_Click">删除</asp:LinkButton>
                                            &nbsp;&nbsp;
                                            <asp:LinkButton ID="GVLB_Rename" runat="server" OnClick="GVLB_Rename_Click">重命名</asp:LinkButton><%-- <asp:LinkButton ID="GvDetail" runat="server" OnClick="GvDetail_Click">详细</asp:LinkButton>--%>
                                        </ItemTemplate>
                                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                            <webdiyer:AspNetPager ID="AspNetPager1" runat="server" ShowCustomInfoSection="Left"
                                CustomInfoHTML="总记录数：%RecordCount%，总页数：%PageCount%，当前为第%CurrentPageIndex%页" CustomInfoTextAlign="left"
                                CustomInfoStyle="padding-top:8px;font-weight:bold;" HorizontalAlign="right" FirstPageText="首页"
                                LastPageText="尾页" NextPageText="下一页" OnPageChanged="AspNetPager1_PageChanged"
                                PrevPageText="上一页" ShowPageIndexBox="Always" SubmitButtonText="Go" TextAfterPageIndexBox="页"
                                TextBeforePageIndexBox="转到" CssClass="anpager" CurrentPageButtonClass="cpb">
                            </webdiyer:AspNetPager>
                            <br />
                            <asp:Label ID="labMsg" runat="server" Visible="false"></asp:Label>
                            <br />
                        </asp:Panel>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button ID="btnAddDir" runat="server" Text="添加目录" OnClick="btnAddDir_Click" />
                        <asp:Button ID="btnRemoveDir" runat="server" Text="删除目录" OnClick="btnRemoveDir_Click" />
                    </td>
                    <td>
                       <%--设置了客户端脚本，为当前目录添加文件，添加完成后，会刷新当前目录--%>
                        <asp:Button ID="btnAddFile" runat="server" Text="添加文件"  />
                        <asp:Button ID="btnHiddenAddFile" Text="" runat="server" style="display:none" OnClick="btnAddFile_Click" />

                    </td>
                </tr>
            </table>
            <asp:Panel ID="panelDelDir" runat="server" Style="display: none" CssClass="modalPopup">
                注意：系统仅允许删除空目录！如果目录下有文件，则不允许删除。如果确实要删除目录及目录下的所有子项（目录和文件），请先删除下级各级目录中的文件，然后逐步删除各个目录。
                <br />
                <br />
                <asp:Label ID="lbDirToDelInfo" runat="server"></asp:Label>
                <br />
                <div style="text-align: right;">
                    <br />
                    <asp:Button ID="btnDelDirOK" runat="server" Text="确定" OnClick="btnDelDir_OK" />
                    <asp:Button ID="btnCancelDelDir" runat="server" Text="取消" />
                </div>
                <br />
                <hr />
            </asp:Panel>
            <asp:Panel ID="panelAddDir" runat="server" Style="display: none" CssClass="modalPopup">
                在目录<b><asp:Label ID="lbCurrentDir" runat="server"></asp:Label></b>下添加子目录:<br />
                <asp:TextBox ID="txtSubDir" runat="server" MaxLength="50" ToolTip="目录名不可超过50个字符"
                    Width="60%" EnableViewState="False"></asp:TextBox>
                <br />
                <br />
                <asp:Button ID="btnAddDirOK" runat="server" Text="确定" OnClick="btnAddDirOK_Click" />
                &nbsp;&nbsp;
                <asp:Button ID="btnAddDirCancel" runat="server" Text="取消" />
                <br />
            </asp:Panel>
            <asp:Button runat="server" ID="hiddenTargetControlForModalPopup" Style="display: none" />
            <asp:Button runat="server" ID="hiddenTargetControlForModalPopup2" Style="display: none" />
            <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderAddDir" runat="server" BehaviorID="programmaticModalPopupBehavior"
                CancelControlID="btnAddDirCancel" TargetControlID="hiddenTargetControlForModalPopup"
                PopupControlID="panelAddDir" BackgroundCssClass="modalBackground">
            </ajaxToolkit:ModalPopupExtender>
            <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BehaviorID="programmaticModalPopupBehavior2"
                CancelControlID="btnCancelDelDir" TargetControlID="hiddenTargetControlForModalPopup2"
                PopupControlID="panelDelDir" BackgroundCssClass="modalBackground">
            </ajaxToolkit:ModalPopupExtender>
        </ContentTemplate>
    </asp:UpdatePanel>
  </div>
</asp:Content>
